using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace TR0217.AboutToAdd
{
    public class MenuStripEx : MenuStrip
    {
        public MenuStripEx()
        {
            this.Visible = false;
        }

        protected override void OnControlAdded(ControlEventArgs e)
        {
            base.OnControlAdded(e);
            this.Visible = true;
        }

        protected override void OnItemAdded(ToolStripItemEventArgs e)
        {
            base.OnItemAdded(e);
            this.Visible = true;
        }

        protected override void OnItemRemoved(ToolStripItemEventArgs e)
        {
            base.OnItemRemoved(e);
            if (this.Items.Count < 1)
                this.Visible = false;
        }
    }
}
